<template>
  <div class="login-container">
    <h2>用户登录</h2>
    <form @submit.prevent="login">
      <input v-model="email" placeholder="邮箱" required />
      <input v-model="password" type="password" placeholder="密码" required />
      <button type="submit">登录</button>
    </form>
    <p>没有账号？<router-link to="/register">立即注册</router-link></p>
  </div>
</template>

<script>
export default {
  name: 'LoginView',
  data() {
    return {
      email: '',
      password: ''
    }
  },
  methods: {
    login() {
      if (this.email && this.password) {
        localStorage.setItem('userToken', 'abc123');
        alert('登录成功');
        this.$router.push('/page-ten/home');
      } else {
        alert('请输入邮箱和密码');
      }
    }
  }
}
</script>